package cn.ww.teach.knowledge.design.observe;

/**
 * Created by Wangwang on 2017/12/12.
 */
public class TestLogin {

    public void goTest() {
        //其他人订阅
        //发送邮件
        LoginHandler handler = LoginHandler.getSubInterface();
        new SendEmail(handler);

        //发送短信
        new SendMessage(handler);

        //模拟登陆成功  拿到了用户信息
        User user = new User();
        //通知其他订阅者
        handler.notify(user);
    }

    public static void main(String[] args) {
        new TestLogin().goTest();
    }
}
